"""
验证新注册用户信息
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from dotenv import load_dotenv
load_dotenv()

from app import create_app
from app.models.user import User

def verify_user():
    """验证新注册用户"""
    app = create_app('development')
    
    with app.app_context():
        print("=" * 60)
        print("查找用户: S20251011")
        print("=" * 60)
        
        user = User.query.filter_by(username='S20251011').first()
        
        if user:
            print("\n✅ 用户找到！")
            print(f"ID: {user.id}")
            print(f"用户名: {user.username}")
            print(f"姓名: {user.last_name}{user.first_name}")
            print(f"角色: {user.role}")
            print(f"学院: {user.college}")
            print(f"系部: {user.department}")
            print(f"邮箱: {user.email}")
            print(f"状态: {'激活' if user.is_active else '禁用'}")
            print(f"创建时间: {user.created_at}")
        else:
            print("\n❌ 用户未找到")
        
        print("\n" + "=" * 60)
        print(f"数据库总用户数: {User.query.count()}")
        print("=" * 60)

if __name__ == '__main__':
    verify_user()


